Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: Sound

| Previous | Chapter contents | Chapter top | Section top |

Managing Source Data

To write a sound output device component, you might need to define routines that manage the flow of data in a sound channel:

SoundComponentStartSource

A sound output device component must implement the SoundComponentStartSource function. The Sound Manager calls this function to start playing sounds in one or more sound channels.

pascal ComponentResult SoundComponentStartSource
                                                              (ComponentInstance ti,
                                                              short count, SoundSource
                     *sources);
ti
A component instance that identifies your sound component.
count
The number of source IDs in the array pointed to by the source parameter.
sources
An array of source IDs.

DESCRIPTION

Your SoundComponentStartSource function is called by the Sound Manager to begin playing the sounds originating from the sound sources specified by the sources parameter. Your function should start (or resume) sending data from those sources to the associated sound output device. If your component supports only one sound source, you can ignore the sources parameter.

SPECIAL CONSIDERATIONS

Your SoundComponentStartSource function can be called at interrupt time.

RESULT CODES

Your SoundComponentStartSource function should return noErr if successful or an appropriate result code otherwise. You should return noErr even if no sounds are playing in the specified channels.

SoundComponentStopSource

A sound output device component must implement the SoundComponentStopSource function. The Sound Manager calls this function to stop playing sounds in one or more sound channels.

pascal ComponentResult SoundComponentStopSource
                                                              (ComponentInstance ti, short
                     count,
                                                              SoundSource *sources);
ti
A component instance that identifies your sound component.
count
The number of source IDs in the array pointed to by the source parameter.
sources
An array of source IDs.

DESCRIPTION

Your SoundComponentStopSource function is called by the Sound Manager to stop the sounds originating from the sound sources specified by the sources parameter. Your function should stop sending data from those sources to the associated sound output device. In addition, your SoundComponentStopSource function should flush any data from the specified sound sources that it's caching. If your component supports only one sound source, you can ignore the sources parameter.

RESULT CODES

Your SoundComponentStopSource function should return noErr if successful or an appropriate result code otherwise. You should return noErr even if no sounds are playing in the specified channels.

SoundComponentPauseSource

A sound output device component must implement the SoundComponentPauseSource function. The Sound Manager calls this function to stop pause the playing of sounds in one or more sound channels.

pascal ComponentResult SoundComponentPauseSource
                                                              (ComponentInstance ti,
                                                              short count, SoundSource
                     *sources);
ti
A component instance that identifies your sound component.
count
The number of source IDs in the array pointed to by the source parameter.
sources
An array of source IDs.

DESCRIPTION

Your SoundComponentPauseSource function is called by the Sound Manager to pause the playing of the sounds originating from the sound sources specified by the sources parameter. Your function should stop sending data from those sources to the associated sound output device. Because your SoundComponentStartSource function might be called to resume playing sounds, you should not flush any data. If your component supports only one sound source, you can ignore the sources parameter.

RESULT CODES

Your SoundComponentPauseSource function should return noErr if successful or an appropriate result code otherwise. You should return noErr even if no sounds are playing in the specified channels.

SoundComponentPlaySourceBuffer

A sound component must implement the SoundComponentPlaySourceBuffer function. The Sound Manager calls this function to start a new sound playing.

pascal ComponentResult SoundComponentPlaySourceBuffer
                                                              (ComponentInstance ti,
                                                              SoundSource sourceID,
                                                              SoundParamBlockPtr pb,
                                                              long actions);
ti
A component instance that identifies your sound component.
sourceID
A source ID for a source component chain.
pb
A pointer to a sound parameter block.
actions
A set of 32 bit flags that describe the actions to be taken when preparing to play the source data. See "Action Flags" for a description of the constants you can use to select bits in this parameter.

DESCRIPTION

Your SoundComponentPlaySourceBuffer function is called by the Sound Manager to start a new sound playing. The sound parameter block pointed to by the pb parameter specifies the sound to be played. That parameter block should be passed successively to all sound components in the chain specified by the sourceID parameter. This allows the components to determine their output formats and playback settings and to prepare for a subsequent call to their SoundComponentGetSourceData function. It also allows a sound output device component to prepare for starting up its associated hardware.

RESULT CODES

Your SoundComponentPlaySourceBuffer function should return noErr if successful or an appropriate result code otherwise.

 


© 1999 Apple Computer, Inc.

| Previous | Chapter contents | Chapter top | Section top |